1. Field of the Invention
The present invention relates to an image forming apparatus, such as a copying machine, a printer, a facsimile or the like, arranged to form an image on a sheet and to discharge the sheet onto a sheet stacking tray provided on the image forming apparatus.
2. Description of Related Art
An image forming apparatus, such as a copying machine, has heretofore been arranged to include a paper feed means for feeding a sheet of recording paper or the like, an image forming means for forming an image on the sheet supplied by the paper feed means, and a sheet discharging means for discharging, to the outside of the body of the apparatus, the sheet having an image formed thereon by the image forming means. Sheets thus discharged by the sheet discharging means are stacked one after another on a sheet stacking tray provided on the apparatus body.
In some of the image forming apparatuses of the above kind, an amount-of-stack detecting sensor for detecting an amount of stack (the height of stack) of sheets on the sheet stacking tray is provided at a sheet discharge port of the sheet discharging means. With the amount-of-stack detecting sensor arranged in this manner, the image forming apparatus can provide such control as to prevent an amount of sheets more than a predetermined amount from being stacked on the sheet stacking tray, thereby preventing jamming or fall of sheets due to excessive stacking of sheets.
It is also known that some of the conventional image forming apparatuses are provided with a plurality of sheet stacking trays (bin trays) for sorting a plurality of sheets having images formed thereon by an image forming means. The image forming apparatus having such a sorting function is arranged to control selection of use of trays for discharging the sheets.
FIG. 11 is a sectional view showing, by way of example, a conventional image forming apparatus having four sheet stacking trays vertically arranged in a four-step configuration which permits sorting sheets out. In the conventional image forming apparatus shown in FIG. 11, sheets P stacked within a paper feed cassette 201 are separated and conveyed one by one by a paper feed means 202. After an image is formed on each sheet by an image forming part 263, the image is fixed to the sheet by a fixing means 204. Paper discharge roller pairs 205a, 205b, 205c and 205d are arranged as a sheet discharging means on one side of the body of the apparatus. Sheet stacking trays 206a, 206b, 206c and 206d are arranged in positions corresponding respectively to the paper discharge roller pairs 205a, 205b, 205c and 205d. 
A sheet to which an image has been fixed by the fixing means 204 is led to the paper discharge roller pair 205a, 205b, 205c or 205d selected, under the change-over control of conveying-path change-over means 207a, 207b and 207c, to be discharged onto the sheet stacking tray 206a, 206b, 206c or 206d corresponding to the paper discharge roller pair as selected. Amount-of-stack detecting sensors 208, 209, 210 and 211 are arranged to detect respectively the amounts of stack of sheets on the sheet stacking trays 206a, 206b, 206c and 206d. 
FIG. 12 shows the arrangement of the amount-of-stack detecting sensors in the conventional image forming apparatus. Referring to FIG. 12, an amount-of-stack detecting lever 208 is arranged to detect the height of stack of sheets stacked on the first sheet stacking tray 206a. The amount-of-stack detecting lever 208 is swingable around a swing shaft 208a disposed above a nip part of the first paper discharge roller pair 205a. A fore end part 208b of the amount-of-stack detecting lever 208 is located on the side of the sheet stacking tray 206a across the discharge path for sheets.
A photo-sensor 208d detects the arrival of the amount of stack of sheets at a predetermined height when the amount-of-stack detecting lever 208 swings to a predetermined position where an actuator 208c which swings integrally with the amount-of-stack detecting lever 208 comes to block the optical axis of the photo-sensor 208d. 
While the conventional image forming apparatus is in process of sorting sheets out, a control means (not shown) is arranged to cause the image forming means to suspend its image forming action on sheets when the amount-of-stack detecting sensor has detected that the sheet stacking tray has been brought into a maximum stacked state during the process of sorting the sheets.
In a case where no sheet sorting action is required, image-formed sheets are stacked, for example, only on the first sheet stacking tray 206a. When the amount-of-stack detecting sensor 208 has detected that the first sheet stacking tray 206a has been brought into a maximum stacked state, the sheet conveying path is changed, under the control of the control means, to the second paper discharge roller pair 205b to cause subsequent sheets to be discharged onto the second sheet stacking tray 206b. 
In the meantime, while image-formed sheets are in process of being continuously stacked on the sheet stacking tray, there is formed a very thin layer of air between one sheet and another. This air layer gradually disappears from between the sheets due to the weight of sheets accordingly as time elapses. Therefore, a stack of sheets generally settles on the tray after the lapse of several minutes from the completion of discharge. As a result, the height of stack of sheets stacked on the sheet stacking tray decreases by an amount corresponding to the thickness of several to ten-odd sheets.
Further, in a case where a sheet is curled (warped) by the fixing action of the fixing means 204, the degree of the curl tends to decrease as the sheet heated by the fixing means 204 cools on the sheet stacking tray. In such a case, a stack of sheets on the tray also comes to settle several minutes after the discharge of sheets, and then the height of stack of sheets also comes to decrease from the height obtained immediately after the discharge of sheets.
Therefore, when the sheets are found by the first amount-of-stack detecting sensor 208 to be fully stacked on the tray while the sheets are in process of being discharged onto the first sheet stacking tray 206a, the control means causes use of the paper discharge port to be changed over to the second paper discharge port. The sheets then come to be discharged from the second paper discharge port onto the second sheet stacking tray 206b. However, while the sheets are being discharged onto the second sheet stacking tray 206b, the stack of sheets on the first sheet stacking tray 206a settles down and the height of stack of sheets stacked on the first sheet stacking tray 206a decrease, so that the detection of the maximum stacked state by the first amount-of-stack detecting sensor 208 comes to be canceled.
This misleads the control means to consider the first sheet stacking tray 206a to be vacant and causes the use of the sheet (paper) discharge port to be changed again to the first paper discharge port. As a result, the sheets cannot be correctly stacked on the trays as the paging sequence of sheets discharged on the trays is disrupted.
Further, even if, after the first sheet stacking tray 206a is brought into a maximum stacked state, the height of stack of sheets stacked on the first sheet stacking tray 206a comes to naturally decrease to cancel the maximum stacked state, the height of stack of sheets stacked on the first sheet stacking tray 206a is very close to the maximum stacked state. Therefore, when sheets of the next job come to be discharged onto the first sheet stacking tray 206a in which the maximum stacked state thereof has been canceled, several to ten-odd sheets are first stacked on the existing stack on the first sheet stacking tray 206a. However, after that, the use of one paper discharge port is soon changed over to another paper discharge port to cause the remaining sheets to be stacked on the second sheet stacking tray 206b. Then, the height of stack of sheets stacked on the first sheet stacking tray 206a again comes to decrease. As a result, the tray for one and the same job repeatedly shifts from the first sheet stacking tray 206a to the second sheet stacking tray 206b and vice versa. This has presented a problem.
In the case of an image forming apparatus, such as a facsimile, a network printer or the like, where sheets stay for a relatively long period of time in a state of being stacked on a sheet stacking tray, the above-stated malfunction saliently takes place to make the problem more serious.
An object of the invention is to provide an image forming apparatus arranged to enhance the utility of the apparatus in cases where the height of stack of sheets stacked on a sheet stacking tray comes to naturally decrease. To attain the above object, in accordance with an aspect of the invention, there is provided an image forming apparatus, which comprises image forming means for forming an image on a sheet, sheet discharging means for discharging a sheet having an image formed thereon by the image forming means, a sheet stacking tray for stacking thereon sheets discharged from the sheet discharging means, first stack height detecting means for detecting whether a height of stack of sheets stacked on the sheet stacking tray has reached a first height, second stack height detecting means for detecting whether the height of stack of sheets stacked on the sheet stacking tray has reached a second height which is higher than the first height, and control means for controlling the image forming apparatus by judging a state of stack of sheets on the sheet stacking tray on the basis of results of detection provided by the first stack height detecting means and the second stack height detecting means, wherein the control means judges the sheet stacking tray to be in a maximum stacked state when the second stack height detecting means has detected that the height of stack of sheets stacked on the sheet stacking tray has reached the second height and, after that, continues judging the sheet stacking tray to be in the maximum stacked state until the first stack height detecting means detects that the height of stack of sheets stacked on the sheet stacking tray has become less than the first height.